package com.mr.orderclient.api;



import com.mr.orderclient.api.impl.ProductForOrderApiImpl;
import com.mr.orderclient.entity.ProductInfo;
import com.mr.orderclient.vo.CartVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
* User (作者): MRui
* TODO (描述)：对商品服务开放的接口api
* Data：2018-11-04 17:48
*/
@Component
@FeignClient(name = "product",fallback = ProductForOrderApiImpl.class)
public interface ProductForOrderApi {

    /**
    * User (作者): MRui
    * TODO (描述)：取商品list
    * Data：2018-11-04 18:08
    */
    @PostMapping("/product/findList")
    List<ProductInfo> findList(@RequestBody List<String> ids);

    /**
    * User (作者): MRui
    * TODO (描述)：减库存
    * Data：2018-11-04 23:16
    */
    @PostMapping("/product/decreaseStock")
    void decreaseStock(@RequestBody List<CartVO> cartVOList);

    /**
    * User (作者): MRui
    * TODO (描述)：feign方式实现hystrix
    * Data：2018-11-18 21:48
    */
    @PostMapping("/product/findListForHystrix")
    List<ProductInfo> findListForHystrix(@RequestBody List<String> ids);


    @GetMapping("/product/test")
    String test();
}
